//@author A0121492M
public class ViewCommand extends Command {
	public int taskId = Task.EMPTY_ID;
	public String taskTitle = Task.EMPTY_STRING;
	
	public ExecutionReply execute()
			throws TaskNotFoundException, NotUniqueException {
		assert (this.taskId != Task.EMPTY_ID ^ this.taskTitle != Task.EMPTY_STRING);
		SingleTaskReply r = new SingleTaskReply();
		int index = -1;
		if (this.taskId != Task.EMPTY_ID) {
			Task tempTask = new Task();
			tempTask.id = this.taskId;
			index = Logic.loadedData.indexOf(tempTask);
		} else if (this.taskTitle != Task.EMPTY_STRING) {
			index = Logic.findIndexByTitle(this.taskTitle);
		}
		
		if (index == -1) {
			throw new TaskNotFoundException();
		} else {
			r.task = Logic.loadedData.get(index);
		}
		return r;
	}
}
